package me.jessyan.mvparms.demo.mvp.ui.activity.shoppcard;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Html;
import android.text.Spannable;
import android.text.Spanned;
import android.view.View;
import android.widget.TextView;

import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import me.jessyan.mvparms.demo.R;
import me.jessyan.mvparms.demo.mvp.ui.widget.CustomEditText;
import me.jessyan.mvparms.demo.mvp.ui.widget.CustomIntColorChangeTextView;
import me.jessyan.mvparms.demo.mvp.ui.widget.CustomToolbar;

/**
 * 绑定购物卡
 */
public class BandShopCardActivity extends BaseActivity {


    @BindView(R.id.toolbar)
    CustomToolbar toolbar;
    @BindView(R.id.one_v)
    View oneV;
    @BindView(R.id.card_num_et)
    CustomEditText cardNumEt;
    @BindView(R.id.pass_word_et)
    CustomEditText passWordEt;
    @BindView(R.id.notice_tv)
    TextView noticeTv;
    @BindView(R.id.sure_tv)
    TextView sureTv;



    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {

    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_band_shopp_card;
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        String str="<font color=\'#7A7E95\' >点击“确认”按钮代表你已阅读并同意接受 </font><font color=\'#4E79FF\' >罗浮广场购物卡使用的特别规定</font>";
        Spanned result;
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
            result = Html.fromHtml(str,Html.FROM_HTML_MODE_LEGACY);
        } else {
            result = Html.fromHtml(str);
        }
        noticeTv.setText(result);

        toolbar.setListener(new CustomToolbar.ToolbarListener() {
            @Override
            public void onLeftBack() {
                finish();
            }

            @Override
            public void onRightBack() {

            }
        });

    }



    @OnClick({  R.id.sure_tv})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.sure_tv:
                Intent intent = new Intent(this,CardDetailActivity.class);
                intent.putExtra("type",CardDetailActivity.CARD_BIND);

                startActivity(intent);
            break;
            default:
        }
    }
}
